/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.download;

import static cn.ac.iie.di.download.DownLoadFile.logger;
import cn.ac.iie.di.global.GlobalParas;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.io.FileUtils;
import static org.apache.commons.io.FileUtils.copyInputStreamToFile;

/**
 *
 * @author Austin
 */
public class test {

    public static void main(String[] args) throws IOException {
        String path = "/new/aaa/ddd/ccc/5555626.apk";
        String[] suffix = path.split("\\.");
        System.out.println(suffix[suffix.length-1]);

//        String RMFERER = "www.baidu.com";
//        String url = "http://shouji.360tpcdn.com/161219/41e131495d076f1838d0a24aef23d5e0/com.lpsewa.ualars_9.apk";
//        File f = new File("C:\\Users\\Austin\\Desktop\\test.apk");
//        URL httpUrl = null;
//        try {
//            httpUrl = new URL(url);
//        } catch (Exception ex) {
//            logger.error("url is not correct " + url + ex.getMessage(), ex);
//        }
//        URLConnection connection = httpUrl.openConnection();
//        if (RMFERER != null && !RMFERER.isEmpty() && !RMFERER.equalsIgnoreCase("null")) {
//            connection.addRequestProperty("referer", RMFERER);
//        }
//        connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
//        connection.setConnectTimeout(1000);
//        connection.setReadTimeout(10000000);
//        copyInputStreamToFile(connection.getInputStream(), f);
//        FileUtils.copyURLToFile(httpUrl, f, 1000, 10000000);
    }
}
